package cn.edu.sgu.www.mhxysy.controller.role;

import cn.edu.sgu.www.mhxysy.consts.CustomConstants;
import cn.edu.sgu.www.mhxysy.consts.CustomMessages;
import cn.edu.sgu.www.mhxysy.consts.MimeTypes;
import cn.edu.sgu.www.mhxysy.entity.role.RoleConfigJiadian;
import cn.edu.sgu.www.mhxysy.restful.JsonResult;
import cn.edu.sgu.www.mhxysy.service.role.RoleConfigJiadianService;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

/**
 * @author 沐雨橙风ιε
 * @version 1.0
 */
@Api(tags = "角色配置加点管理")
@ApiSupport(author = CustomConstants.AUTHOR)
@Validated
@RestController
@RequestMapping(path = "/role_config_jiadian", produces = MimeTypes.APPLICATION_JSON_CHARSET_UTF_8)
public class RoleConfigJiadianController {

    private final RoleConfigJiadianService roleConfigJiadianService;

    @Autowired
    public RoleConfigJiadianController(RoleConfigJiadianService roleConfigJiadianService) {
        this.roleConfigJiadianService = roleConfigJiadianService;
    }

    @ApiOperation("通过角色配置方案ID查询角色配置加点")
    @RequestMapping(value = "/selectByConfigId", method = RequestMethod.GET)
    public JsonResult<RoleConfigJiadian> selectByConfigId(
            @ApiParam(name = "configId", value = "角色配置方案ID", required = true)
            @NotNull(message = "角色配置方案" + CustomMessages.ID_NOT_NULL) Integer configId) {
        RoleConfigJiadian roleConfigJiadian = roleConfigJiadianService.selectByConfigId(configId);

        return JsonResult.success(null, roleConfigJiadian);
    }

}